package com.example.bgxqmanage.config.swagger;
import com.example.bgxqmanage.interceptor.AdminInterceptor;
import com.example.bgxqmanage.interceptor.LogInterceptor;
import com.example.bgxqmanage.interceptor.RemoveInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 拦截器配置
 * @author lizijian
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

  @Autowired
  private RemoveInterceptor removeInterceptor;

  @Autowired
  private LogInterceptor logInterceptor;

  @Autowired
  private AdminInterceptor adminInterceptor;

  @Override
  public void addInterceptors(InterceptorRegistry registry) {
    //taskId获取
    registry.addInterceptor(logInterceptor).addPathPatterns("/bgxq/**");
    //清除threadLocal
    registry.addInterceptor(removeInterceptor).addPathPatterns("/bgxq/**");
    //管理员登陆状态
    registry.addInterceptor(adminInterceptor).addPathPatterns("/bgxq/**").excludePathPatterns("/bgxq/manager/login");
  }





}
